# Maintainer: Patrick Gansterer <paroga@paroga.com>
pkgname=thrift
pkgver=0.16.0
pkgrel=2
pkgdesc="Language-independent software stack for RPC implementation"
url="https://thrift.apache.org/"
arch="all !s390x" # failing tests
license="Apache-2.0"
makedepends="autoconf automake bison boost-dev boost-static flex
	libevent-dev libtool openssl1.1-compat-dev zlib-dev"
subpackages="$pkgname-libs-cpp:libscpp $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/apache/thrift/archive/v$pkgver.tar.gz
	missing-signal-h.patch
	musl-libc-locale.patch
	skip-old-tls-tests.patch
	"

# secfixes:
#   0.14.0-r0:
#     - CVE-2020-13949

prepare() {
	default_prepare
	./bootstrap.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--without-python \
		--without-py3 \
		--disable-tutorial
	make
}

check() {
	make -k check
}

package() {
	make DESTDIR="$pkgdir" install
}

libscpp() {
	pkgdesc="Thrift C++ library"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*-*.so "$subpkgdir"/usr/lib
}

sha512sums="
f89429d1f1d5ed14c03baf848c145bc081867f4acaebc009e9738981c844cae1d25ac195b06e8e9c5a702a03b75cd04e694190f0e0acaeff15cab20a4a003295  thrift-0.16.0.tar.gz
72db52532e03ab2c8bca03f61b427632eb0f7bf0bb29a2e90f2fab2a3775d589791083848236ed88b23eecb8c6a134b335669997df66f11483f2b614d946bd5b  missing-signal-h.patch
0aea996e83d64e75f825bbac2c038e08ae541c4f6e28ef729644cb629a983f8cba07447ed4ead6a6f34ac5baa2264273b503add29e5750e498d36a3ee8f7572f  musl-libc-locale.patch
09c9dd046e66ce8897580db3671180ef44520c53a151cd2f2cd9db7900245f3c7b14a58de5842e1e785497a6f0348d2161af29affd06d041234bcf3a91870b8d  skip-old-tls-tests.patch
"
